﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace HigLabo.Net.Twitter
{
    public partial class TwitterClient
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public SavedSearchCollection GetSavedSearchesList()
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.SavedSearches.GetSavedSearchesUrl);
            return new SavedSearchCollection(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SavedSearch GetSavedSearchesById(Int64 id)
        {
            String url = String.Format(TwitterApiUrl.Version1_1.SavedSearches.GetSavedSearchesByIdUrl, id);
            String jsonText = this.GetResultText(url);
            return new SavedSearch(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public SavedSearch CreateSavedSearches(String query)
        {
            CreateSavedSearchesCommand command = new CreateSavedSearchesCommand();
            command.Query = query;
            String jsonText = this.GetResultText(HttpMethodName.Post, TwitterApiUrl.Version1_1.SavedSearches.CreateSavedSearchesUrl, command);
            return new SavedSearch(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public SavedSearch CreateSavedSearches(CreateSavedSearchesCommand command)
        {
            String jsonText = this.GetResultText(HttpMethodName.Post, TwitterApiUrl.Version1_1.SavedSearches.CreateSavedSearchesUrl, command);
            return new SavedSearch(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SavedSearch DestroySavedSearches(Int64 id)
        {
            String url = String.Format(TwitterApiUrl.Version1_1.SavedSearches.DestroySavedSearchesIdUrl, id);
            String jsonText = this.GetResultText(HttpMethodName.Post, url);
            return new SavedSearch(jsonText);
        }
    }
}
